using Cysharp.Threading.Tasks;
using Cysharp.Threading.Tasks.Triggers;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;


//���� MonoBehaviour ��Ϣ�¼�������ת���첽��AsyncTriggers������ͨ��using Cysharp.Threading.Tasks.Triggers;�������ã�.AsyncTrigger ����ʹ�� UniTaskAsyncEnumerable ��������ͨ��GetAsync***Trigger������
public class Fifteen : MonoBehaviour
{
    public GameObject ball;

    private void Start()
    {
        // TestCol().Forget();
        TestClick().Forget();
    }

    private void Update()
    {
        ball.transform.Translate(new Vector3(1, 0, 0) * Time.deltaTime);
    }

    private async UniTaskVoid TestCol()
    {
        var col = ball.GetAsyncCollisionEnterTrigger();
        await col.OnCollisionEnterAsync();
        Debug.Log("发生了碰撞");
    }

    private async UniTaskVoid TestClick()
    {
        var click = ball.GetAsyncMouseDownTrigger();
        await click.OnMouseDownAsync();
        Debug.Log("12");
    }
}